/////////////////////////////////////////////////////////////////////////////
// Name:        ax_menu_library_settings.h
// Purpose:     Library settings menu classes
// Author:      Julian Smart
// Modified by:
// Created:     2009-03-20
// RCS-ID:
// Copyright:   (c) Julian Smart
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _AX_MENU_LIBRARY_SETTINGS_H_
#define _AX_MENU_LIBRARY_SETTINGS_H_

/*
 * Includes
 */

#include "ax/ax_menu.h"
#include "ax/ax_activator.h"

class AxResourceLibrary;

/**
    @class AxResourceLibrarySettingsMenuItem

    A menu item for accessing resource library settings.

    @category{ax_resource}

 */

class AxResourceLibrarySettingsMenuItem: public AxMenuItem
{
    DECLARE_DYNAMIC_CLASS( AxResourceLibrarySettingsMenuItem )

public:
// Constructors

    AxResourceLibrarySettingsMenuItem(const AxResourceLibrarySettingsMenuItem& item) { Copy(item); }
    AxResourceLibrarySettingsMenuItem() {}
    AxResourceLibrarySettingsMenuItem(AxResourceLibrary* library, const wxString& label = wxEmptyString, const wxString& description = wxEmptyString,
        const wxString& id = wxEmptyString);

   virtual AxMenuItem* Clone() const { return new AxResourceLibrarySettingsMenuItem(* this); }
};

/**
    @class AxResourceLibrarySettingsActivator

    Creates the menu containing the resource library settings.

    @category{ax_resource}
 */

class AxResourceLibrarySettingsActivator: public AxActivator
{
    DECLARE_DYNAMIC_CLASS( AxResourceLibrarySettingsActivator )

public:
// Constructors

    AxResourceLibrarySettingsActivator(AxResourceLibrary* library = NULL) { Init(); m_library = library; }
    AxResourceLibrarySettingsActivator(const AxResourceLibrarySettingsActivator& activator) { Init(); Copy(activator); }

    ~AxResourceLibrarySettingsActivator() {}

// Operations

    void Init() { m_library = NULL; }

    virtual AxActivator* Clone() const { return new AxResourceLibrarySettingsActivator(*this); }

    void Copy(const AxResourceLibrarySettingsActivator& activator);

    /// Called when the user activates a menu item by pressing return or double-clicking
    virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);

    /// Get the resource library for the given menu item, by climbing the
    /// hierarchy and finding this activator.
    static AxResourceLibrary* GetResourceLibrary();

protected:
    AxResourceLibrary* m_library;
};

/**
    @class AxResourceLibraryAddByFolderMenuItem

    A menu item for adding items to the resource library by prompting for a folder.

    @category{ax_resource}

 */

class AxResourceLibraryAddByFolderMenuItem: public AxMenuItem
{
    DECLARE_DYNAMIC_CLASS( AxResourceLibraryAddByFolderMenuItem )

public:
// Constructors

    AxResourceLibraryAddByFolderMenuItem(const AxResourceLibraryAddByFolderMenuItem& item) { Copy(item); }
    AxResourceLibraryAddByFolderMenuItem() {}
    AxResourceLibraryAddByFolderMenuItem(AxResourceLibrary* library, const wxString& label = wxEmptyString, const wxString& description = wxEmptyString,
        const wxString& id = wxEmptyString);

    virtual AxMenuItem* Clone() const { return new AxResourceLibraryAddByFolderMenuItem(* this); }
};

/**
    @class AxResourceLibraryAddByFileMenuItem

    A menu item for adding items to the resource library by prompting for a file.

    @category{ax_resource}

 */

class AxResourceLibraryAddByFileMenuItem: public AxMenuItem
{
    DECLARE_DYNAMIC_CLASS( AxResourceLibraryAddByFileMenuItem )

public:
// Constructors

    AxResourceLibraryAddByFileMenuItem(const AxResourceLibraryAddByFileMenuItem& item) { Copy(item); }
    AxResourceLibraryAddByFileMenuItem() {}
    AxResourceLibraryAddByFileMenuItem(AxResourceLibrary* library, const wxString& label = wxEmptyString, const wxString& description = wxEmptyString,
        const wxString& id = wxEmptyString);

    virtual AxMenuItem* Clone() const { return new AxResourceLibraryAddByFileMenuItem(* this); }
};

/**
    @class AxResourceLibraryAddActivator

    Performs commands for adding items to the library.

    @category{ax_resource}
 */

class AxResourceLibraryAddActivator: public AxActivator
{
    DECLARE_DYNAMIC_CLASS( AxResourceLibraryAddActivator )

public:
    typedef enum 
    {
        AxResourceLibraryAddCommandUnknown,
        AxResourceLibraryAddByFolderCommand,
        AxResourceLibraryAddByFileCommand
            
    } AxResourceLibraryAddCommand;
    
// Constructors

    AxResourceLibraryAddActivator(AxResourceLibraryAddCommand command = AxResourceLibraryAddCommandUnknown, AxResourceLibrary* library = NULL)
    { Init(); m_command = command; m_library = library; }
    AxResourceLibraryAddActivator(const AxResourceLibraryAddActivator& activator) { Init(); Copy(activator); }

    ~AxResourceLibraryAddActivator() {}

// Operations

    void Init() { m_library = NULL; }

    virtual AxActivator* Clone() const { return new AxResourceLibraryAddActivator(*this); }

    void Copy(const AxResourceLibraryAddActivator& activator);

    /// Called when the user activates a menu item by pressing return or double-clicking
    virtual AxMenu* Activate(AxMenuController* controller, AxMenuItem* item);

    /// Get the resource library for the given menu item, by climbing the
    /// hierarchy and finding this activator.
    static AxResourceLibrary* GetResourceLibrary();

protected:
    AxResourceLibraryAddCommand m_command;
    AxResourceLibrary*          m_library;
};


#endif
    // _AX_MENU_LIBRARY_SETTINGS_H_
